package com.xx.service.impl;

import com.xx.dao.*;
import com.xx.domain.Permission;
import com.xx.domain.Role;
import com.xx.service.RoleServce;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
 * @Author : 徐闯 ssm_admin
 * @Date : 2021-05-18 11:05:44
 * @Description : 角色操作
 **/
@Service
public class RoleServiceImpl implements RoleServce {
    @Autowired
    private FindRoleMapper findRoleMapper;
    @Autowired
    private InsertRoleMapper insertRoleMapper;
    @Autowired
    private DeleteRoleMapper deleteRoleMapper;
    @Autowired
    private FindPermissionMapper findPermissionMapper;
    @Autowired
    private InsertPermissionMapper insertPermissionMapper;
    @Override
    public List<Role> findALl() {
        return findRoleMapper.findALl();
    }

    @Override
    @Transactional
    public int deleteOne(int rId) {
        return deleteRoleMapper.deleteOne(rId);
    }

    @Override
    @Transactional
    public int deleteAll(int[] rIds) {
        return deleteRoleMapper.deleteALl(rIds);
    }

    @Override
    @Transactional
    public int insertOne(Role role) {
        return insertRoleMapper.insertOne(role);
    }

    @Override
    public List<Permission> findList(int rId) {
        return findPermissionMapper.findList(rId);
    }

    @Override
    public int insertPermission(Map map) {
        return insertPermissionMapper.insertList(map);
    }
}
